package com.hwg.emp.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hwg.emp.service.OvertimeService;
import com.hwg.emp.service.ServiceFactroy;

public class DeleteEmpOvertimeController extends HttpServlet{
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		req.setCharacterEncoding("utf8");
		String sidsStr=req.getParameter("sids");
		String sids[]=sidsStr.split(",");
		OvertimeService overtimeService=ServiceFactroy.getService(OvertimeService.class);
		try {
			boolean flag=overtimeService.deleteEmpOvertime(sids);
			if(flag){
				req.getRequestDispatcher("/selectEmpOvertimes.do").forward(req, resp);
			}
			else {
				req.setAttribute("erro", "对不起，删除失败");
				req.getRequestDispatcher("/selectEmpOvertimes.do").forward(req, resp);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
